#pragma once

#include <vector>

namespace HFSME{


class HStateBase;

namespace detail{

typedef HStateBase* (*state_factory)(void);

struct SubStateInfo{
	state_factory	theFactory;
	bool			isInitial;
	SubStateInfo(state_factory aFactory,bool initial)
		:theFactory(aFactory),
		 isInitial(initial)
	{}
};

struct HStaticTreeStructure
{
	std::vector<SubStateInfo> theSubstatesFactories;

	HStaticTreeStructure()
	{

	}

	unsigned int size(void) const
	{
		return theSubstatesFactories.size();
	}
	template <typename SubState,bool isInitial=false>
	void register_substate(void)
	{
		struct local
		{
			static HStateBase *factory_function(void)
			{
				auto sub=new SubState();
				return sub;
			}
		};
		theSubstatesFactories.push_back(SubStateInfo(&local::factory_function,isInitial));

		//detect if the substate class has the register method and call it
	}
};


} //namespace detail
} //namespace HFSME
